package pkgBFPaint;

import java.awt.*;
import java.util.LinkedList;
import java.util.ListIterator;

public abstract class Action {

	protected LinkedList<Point> points = new LinkedList<Point>();
	protected Color color = Color.black;
	protected int actionID;

	public abstract void draw(Graphics g);

	public Action addPoint(Point p) {

		points.add(p);
		return this;
	}
	
	public Point getFirstPoint() {
		
		return points.getFirst();
	}
	
	public void removeLastTwo(){
		if(!points.isEmpty())
			points.removeLast();
		if(!points.isEmpty())
			points.removeLast();
	}
	
	public boolean isEmpty(){
		return points.isEmpty();
	}
	
	void changeLast( Point p ){
		points.removeLast();
		points.add(p);
	}

	public boolean equals(Action a) {
		if ((getActionID() == a.getActionID()) && (getColor().equals((Color) a.getColor())))
			return true;
		else
			return false;
	}

	public int getActionID() {
		return actionID;
	}

	public Color getColor() {
		return color;
	}

}
